package com.liuweiheng.springcloud.controller;


import com.liuweiheng.base.entity.R;
import com.liuweiheng.springcloud.service.PaymentFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试OpenFeign服务调用控制器
 * 需要指定对应的“请求路径”
 * 这里需要跟调用服务的控制器接口一致
 * @author lwh
 */
@RestController
@RequestMapping("/openFeign/order")
public class OpenFeignOrderController {


    @Autowired
    private PaymentFeignService paymentFeignService;

    /**
     * 测试Feign调用远程接口
     * @return
     */
    @GetMapping("/test")
    public R testOpenFeign() {

        return paymentFeignService.checkUtil();

    }

    /**
     * 测试Feign超时调用
     * @return
     */
    @GetMapping("/timeout")
    public R testFeignTimeout() {
        return paymentFeignService.testTimeout();
    }

}
